home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / satan-1.1.1 / bin / rsh.satan < prev    next >
Text File  |  1996-04-24  |  2KB  |  79 lines

  1. #!/bin/sh
  2. #
  3. #  Does host trust us?  What is in hosts.equiv (probably a "+", if
  4. # this works...)  Should run as "root"
  5. #
  6. #  CHANGES TO BE DONE: do something with the output.
  7. #
  8. #
  9. # version 2, Sat Apr  8 21:02:49 1995, last mod by wietse
  10. #
  11.  
  12. . config/paths.sh
  13.  
  14. user=bin
  15. tmp_file="./tmp_file.$$"
  16.  
  17. # arg stuff:
  18. while $TEST $# != 0
  19.         do      case "$1" in
  20.         -u)     user=$2 ; shift ;;
  21.         *)      target=$1
  22.         esac
  23.         shift
  24.         done
  25.  
  26. if $TEST "X$target" = "X" ; then
  27.         $ECHO Usage $0 [-u user] target
  28.         exit 1
  29.         fi
  30.  
  31. # used in final output
  32. # target=$1
  33. service=`$BASENAME $0 | $SED 's/\..*$//'`
  34. status="a"
  35. service_output=""
  36.  
  37.  
  38. # Check to see if we are who we should be -- bin or whatever:
  39. whoami=`$WHOAMI`
  40.  
  41. if $TEST "$whoami" = "root" ; then
  42.     $RCMD $target $user "file /bin/sh" > $tmp_file 2> /dev/null
  43. else
  44.     # $ECHO Must be run as root
  45.     exit 2
  46.     fi
  47.  
  48. if $GREP /bin/sh "$tmp_file" >/dev/null ; then
  49.     # do we want to put the output into a data file?
  50.     # $ECHO $target /etc/hosts.equiv file: `$CAT $tmp_file`
  51.     trustee="USER@$target"
  52.     service_output="remote shell access"
  53.     if $TEST $user = "bin" ; then
  54.         trusted="ANY@ANY"
  55.         text="rshd trusts the world"
  56.  
  57.         # assume if you can get bin, a "+" in hosts.equiv, == root
  58.             severity="rs"
  59.     else
  60.         trusted="$user@ANY"
  61.         text="user $user trusts the world"
  62.             severity="us"
  63.         fi
  64. else
  65.     severity=""
  66.     trustee=""
  67.     trusted=""
  68.     service_output=""
  69.     text="doesn't trust the world"
  70.     fi
  71.  
  72. $ECHO "$target|$service|$status|$severity|$trustee|$trusted|$service_output|$text"
  73.  
  74. $RM -f $tmp_file
  75.  
  76. exit 0
  77.  
  78. # finis
  79.